from extends import douyin
from common.ApiBase import ApiBase


class Views(ApiBase):

    def get_pull(request):
        if request.GET.get('url') is None:
            return ApiBase.res_json({}, 'url is null')

        url = request.GET.get('url');
        res_info = douyin.get_real_url(url)

        if type(res_info) is dict:
            return ApiBase.res_json(res_info)
        else:
            return ApiBase.res_json({}, res_info)
